Skip to content

feat(hpc): WHT polyfill, i2 quantization, pub kmeans#105

Merged
AdaWorldAPI merged 2 commits into
masterfrom
claude/teleport-session-setup-wMZfb
Apr 17, 2026
Merged

feat(hpc): WHT polyfill, i2 quantization, pub kmeans#105
AdaWorldAPI merged 2 commits into
masterfrom
claude/teleport-session-setup-wMZfb

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Summary

  • WHT (Walsh-Hadamard Transform) in fft.rs — F32x16 SIMD butterfly, O(n log n), self-inverse, energy-preserving. 3 unit tests + doctest. Same module family as FFT.
  • i2 quantization in quantized.rsquantize_f32_to_i2 / dequantize_i2_to_f32, ternary {-1,0,+1}, 4 crumbs per byte. Completes the i4/i8/u8/BF16 suite.
  • pub fn kmeans() and pub fn squared_l2() in cam_pq.rs — were private helpers, now public for downstream codec use.

These are the additive polyfills needed by bgz-tensor::had_cascade (the production Hadamard cascade codec that achieved ICC 0.999 on real model weights).

Test plan

  • cargo test -p ndarray -- hpc::fft — 6 tests pass (3 FFT + 3 WHT)
  • WHT doctest passes
  • WHT self-inverse verified at 1024-d (SIMD path)
  • WHT energy preservation verified
  • i2 quantize/dequantize roundtrip tested in bgz-tensor downstream
  • kmeans already had existing test (test_kmeans_basic)

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh

claude added 2 commits April 17, 2026 10:46
Three additive pieces for the HadCascade codec in bgz-tensor:

1. wht_f32() in fft.rs — Walsh-Hadamard Transform with F32x16 SIMD
   butterfly. O(n log n), self-inverse, energy-preserving. 3 tests +
   doctest. Same module family as FFT (Cooley-Tukey).

2. quantize_f32_to_i2 / dequantize_i2_to_f32 in quantized.rs —
   ternary {-1, 0, +1} quantization, 4 crumbs per byte. Completes
   the i4/i8/u8/BF16 quantization suite for the i2 residue pass.

3. pub fn kmeans() and pub fn squared_l2() in cam_pq.rs — were
   private helpers, now public. Farthest-first init + Lloyd's
   iterations, SIMD-dispatched L2 distance.

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
@AdaWorldAPI AdaWorldAPI merged commit 9c19a20 into master Apr 17, 2026
5 of 14 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Apr 19, 2026
…ed PRs

Bookkeeping ledger pairing each prompt brief in .claude/prompts/ with its
matching PR (by filename keyword). 4 mapped to merged PRs #72/#73/#74/#105;
21 marked `none` where no keyword match existed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants